<!DOCTYPE HTML>
<html>
<head>

<script type="text/javascript" src="../../js/jquery-1.8.2.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$("#get").click(function() {
			var surl = "http://localhost:81/gallery/index.php?";
			var id = $(this).attr("id");
			$.ajax({
				url : surl,
				data : {
					id : id
				},
				dataType : "jsonp",
				jsonp : "callback",
				jsonpCallback : "jsonpcallback"
			});
		});
	});

	// Named callback function from the ajax call when jsonpbtn2 clicked
	function jsonpcallback(rtndata) {

		// Get the id from the returned JSON string and use it to reference the target jQuery object.
		var myid = rtndata.src;
		var img = '<img src="'+myid+'" width="50" height="50">';
		$("#imgs").append(img);
	}
</script>


</head>
<body>

	<div id="imgs">

		<button id="get">Get</button>

	</div>


</body>
</html>